
        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">{$title}</div>
                                <div class="widget-function am-fr">
                                    <a href="javascript:;" class="am-icon-cog"></a>
                                </div>
                            </div>
                            <div class="widget-body am-fr">

                                <form id="m_form" class="am-form tpl-form-line-form" method="post" action="{:U('edit')}">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">角色名</label>
                                        <div class="am-u-sm-9">
                                            <input name="name" value="{$role.name}" type="text" class="tpl-form-input" id="user-name" placeholder="请填写角色名">
                                            <small>20个字之内</small>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">权限</label>
                                        <div class="am-u-sm-9">
                                            <volist name="privilege" id="vo">
                                                <php> if($vo['level'] == 1){ $mark = $i; } </php>
                                                <label style="cursor: pointer" data_id = {$mark}  <eq name="vo.level"  value="1">class='am-checkbox lvone'<else/>class='am-checkbox-inline lvtwo'</eq> >
                                                    <input
                                                            <php>
                                                                foreach($role['privilege'] as $v){
                                                                    if($v == $vo['id']){
                                                                        echo checked;
                                                                        break;
                                                                    }
                                                                }
                                                            </php>
                                                            type="checkbox" name="privilege[]" value="{$vo.id}">{$vo.name}

                                                </label>
                                            </volist>

                                        </div>
                                        <div class="am-u-sm-9" style="margin-top: 20px">
                                            <button type="button" class="all_select am-btn am-btn-success">全选</button>
                                            <button type="button" class="no_select am-btn am-btn-danger">全不选</button>
                                        </div>
                                    </div>



                                    <div class="am-form-group">
                                        <div  class="am-u-sm-9 am-u-sm-push-3">
                                            <input name = 'id'type="hidden" value="{$role.id}">
                                            <input type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success">
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <script>
            $(document).ready(function () {
                $('.lvone').click(function (event) {
                    //过滤label的点击
                    if($(event.target).is('label')){
                        return ;
                    }
                    var status = $(this).children('input').prop("checked");
                    var data_id = $(this).attr("data_id");
                    $('.lvtwo').filter(function(){
                        return  $(this).attr("data_id") == data_id;
                    }).children('input').prop({"checked":status});
                })

                $('.lvtwo').click(function(event){
                    //过滤label的点击
                    if($(event.target).is('label')){
                        return;
                    }
                    var data_id = $(this).attr("data_id"); //注意 #(this)是label对象，不是input
                    $lvtwo = $(".lvtwo").filter(function(){
                        return  $(this).attr("data_id") == data_id;
                    });
                    $check_lvtwo = $lvtwo.children('input').filter(":checked");
                    var status = ($check_lvtwo.length > 0 )?true:false;
                    $('.lvone').filter(function(){
                        return  $(this).attr("data_id") == data_id;
                    }).children('input').prop({"checked":status});
                });

                $(".all_select").click(function () {
                    $("#m_form :checkbox").prop({"checked":true});
                })


                $(".no_select").click(function () {
                    $("#m_form :checkbox").prop({"checked":false});
                })

            });//ready end 
        </script>
